<?php
/**
 * 全局底部调用
 */
?>
<footer class="footer">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-6">
                2019 - 2022 © All rights reserved - 武汉小储科技有限公司
            </div>
            <div class="col-md-6">
                <div class="text-md-right footer-links d-none d-md-block">
                    <a href="" id="code_img" target="_blank">官方公众号</a>
                    <a href="javascript: void(0);" class="group" target="_blank">官方交流群</a>
                </div>
            </div>
        </div>
    </div>
</footer>
<!-- bundle -->
<script src="<?= $cdnserver == null ? '../' : $cdnserver ?>assets/js/app.min.js"></script>
<!-- third party js -->
<script src="<?= $cdnpublic ?>Chart.js/2.7.3/Chart.bundle.min.js"></script>
<script src="<?= $cdnserver == null ? '../' : $cdnserver ?>assets/js/vendor/jquery-jvectormap-1.2.2.min.js"></script>
<script src="<?= $cdnserver == null ? '../' : $cdnserver ?>assets/js/vendor/jquery-jvectormap-world-mill-en.js"></script>
<script src="<?= $cdnserver == null ? '../' : $cdnserver ?>assets/layui/layui.all.js"></script>
<!-- third party js ends -->
<script>
    layui.use('flow', function () {
        var flow = layui.flow;
        flow.lazyimg();
    });
    // layer.config({
    //     skin: 'demo-class'
    // })
</script>
<!-- demo app -->
<script src="<?= $cdnserver == null ? '../' : $cdnserver ?>assets/js/pages/demo.dashboard.js"></script>
<!-- end demo js-->
<script>

    function data_header() {
        var datar = layui.data('header_data');
        if (datar.data != undefined) {
            var headertime = layui.data('headertime');
            var mis = headertime.time - 1;
            if (mis > 0) {
                header_datas(JSON.parse(datar.data));
                layui.data('headertime', {
                    key: 'time'
                    , value: mis
                });
                return false;
            }
        }
        $.ajax({
            type: "post",
            url: "ajax.php?act=data_header",
            dataType: "json",
            success: function (data) {

                var datas = JSON.stringify(data);
                layui.data('header_data', {
                    key: 'data'
                    , value: datas
                });
                /**
                 * 18次一轮询，提高网站速度
                 */
                layui.data('headertime', {
                    key: 'time'
                    , value: 38
                });

                header_datas(data);
            }
        });
    }

    function header_datas(data) {
        if (data.code == 1) {
            $("#code_img").attr('href', data.weix_img);
            $(".group").attr('href', data.TheOfficialGroup);
            $("#head_image").attr('src', data.image);
            $("#header_name").text(data.name);
            var content = '';
            for (let a = 0; a < data.notice.length; a++) {
                content += '<a href="?message=' + data.notice[a]['id'] + '" class="dropdown-item notify-item">\n' +
                    '          <div class="notify-icon bg-primary">\n' +
                    '             <i class="mdi mdi-comment-account-outline"></i>\n' +
                    '          </div>\n' +
                    '          <p class="notify-details">' + data.notice[a]['title'] + '\n' +
                    '                <small class="text-muted">' + data.notice[a]['date'] + '</small>\n' +
                    '          </p>\n' +
                    '       </a>';
            }
            $("#message").html(content);
        } else if (data.code == -2) {
            setTimeout(function () {
                index_update();
            }, 1000);
        } else {
            layui.data('headertime', {
                key: 'time'
                , value: 0
            });
            layer.msg(data.msg, {icon: 4});
        }
    }

    data_header();

</script>
